import React, { Component } from 'react';
import {
    StyleSheet,
    View,
    Text,
    Image,
} from 'react-native'
import { birthdayToAges } from '../../utils/utils_date'


class PatientBaseHeader extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    static defaultProps = {
        //图片集合
        baseInfo: {},

    }

    render() {

        const item = this.props.baseInfo;
        console.log(item)



        if (!item.name) {
            return <View />
        }
        return (
            <View
                style={{
                    width: screenWidth,
                    height: 80,
                    flexDirection: 'row',
                    borderBottomColor: '#efefef',
                    borderBottomWidth: 1,
                    backgroundColor: 'white',
                    paddingLeft: 10,
                    paddingRight: 10
                }}
            >
                <View style={{ width: screenWidth - 120, height: 80 }}>
                    <View style={styles.lineStyle}>
                        <Text style={{ fontSize: 16 }}>{item.name}</Text>

                        <Text style={{ marginLeft: 25 }}>
                            {item.sex}/{birthdayToAges(item.birthday)}
                        </Text>

                        <Text style={{ marginLeft: 25 }}>{item.bed_no}</Text>
                    </View>

                    <View style={styles.lineStyle}>
                        <Text style={{ width: 150 }}>诊断：{item.diagnose}</Text>

                        <Text style={{ marginLeft: 25, color: 'red' }}>{item.allergy}</Text>
                    </View>
                </View>

                <View style={{ width: 100, height: 80, flexDirection: 'row' }}>
                    <View
                        style={{
                            width: 40,
                            height: 80,
                            justifyContent: 'center',
                            alignItems: 'center'
                        }}
                    >
                        {item.name === '王小翠' ? (
                            <Image
                                source={require('./src/shenhe.png')}
                                style={{ width: 40, height: 40 }}
                            />
                        ) : null}
                    </View>
                    <View
                        style={{
                            width: 60,
                            height: 80,
                            justifyContent: 'center',
                            alignItems: 'center'
                        }}
                    >
                        <Text style={{ fontSize: 20 }}>
                            {/* {item.hasAdvNum}/{item.totalAdvNum} */}
                        </Text>
                    </View>
                </View>
            </View>
        );
    }
}

const styles = StyleSheet.create({

    lineStyle: {
        width: screenWidth - 120,
        height: 40,
        flexDirection: 'row',
        alignItems: 'center'
    }
})

export default PatientBaseHeader;